//
//  WKTopTableViewCellFrame.m
//  WKDemo
//
//  Created by wjm on 14-8-6.
//  Copyright (c) 2014年 com.app. All rights reserved.
//

#import "WKTopTableViewCellFrame.h"


@implementation WKTopTableViewCellFrame
- (void)setTopreqsult:(WKResult *)Topreqsult
{
    _Topreqsult = Topreqsult;
    //用户头像
    CGFloat iconX = WKStatusCellInset;
    CGFloat iconY = WKStatusCellInset;
    CGFloat iconW = 40;
    CGFloat iconH = 40;
    self.userIconFrame = CGRectMake(iconX, iconY, iconW, iconH);
    
    //名字
    CGFloat nameX = CGRectGetMaxX(self.userIconFrame) + WKStatusCellInset;
    CGFloat nameY = WKStatusCellInset;
    CGSize nameSize = [Topreqsult.name sizeWithFont:[UIFont systemFontOfSize:12]];
    self.userNameFrame = (CGRect){{nameX, nameY}, nameSize};
    
    //发送时间
    CGFloat timeX = nameX;
    CGFloat timeY = CGRectGetMaxY(self.userNameFrame) + WKStatusCellInset;
    CGSize timeSize = [Topreqsult.passtime sizeWithFont:[UIFont systemFontOfSize:10]];
    self.userSendTimeFrame = (CGRect){{timeX, timeY}, timeSize};
    
    //段子内容
    CGFloat textX = WKStatusCellInset;
    CGFloat textY = CGRectGetMaxY(self.userIconFrame) +WKStatusCellInset;
    CGSize maxSize = CGSizeMake(300, MAXFLOAT);
    CGSize  textSize = [Topreqsult.text sizeWithFont:[UIFont systemFontOfSize:14] constrainedToSize:maxSize];
    self.userTextFrame = (CGRect){{textX, textY}, textSize};

    //底部的评论框
    CGFloat toobX = 0;
    CGFloat toobY = CGRectGetMaxY(self.userTextFrame) +WKStatusCellInset;
    CGFloat toobW = 320;
    CGFloat toobH = 30;
    self.userBootFrame = CGRectMake(toobX, toobY, toobW, toobH);

    //自己framg
    CGFloat TopTableViewX = 0;
    CGFloat TopTableViewY = 5;
    CGFloat TopTableViewW = WKScreenW;
    CGFloat TopTableViewH = CGRectGetMaxY(self.userBootFrame) + WKStatusCellInset;
    self.frame = CGRectMake(TopTableViewX, TopTableViewY, TopTableViewW, TopTableViewH);
    self.cellHeight = CGRectGetMaxY(self.frame);
}

@end
